package com.aaa.dao;

import com.aaa.entity.Fcart;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface FcartMapper extends BaseMapper<Fcart> {
    @Select("select b.head,b.`name`,b.price,c.user,c.time,c.number,c.id,c.prices from f_cart c left join book b on c.book=b.id where c.user=#{user} ")
  List<Map<String,Object>> find(Integer user);
    @Select("SELECT fc.id,b.`name`,b.head,fc.number,fc.prices,fu.`name` FROM f_cart fc LEFT JOIN book b on fc.book=b.id LEFT JOIN f_user fu on fc.f_user=fu.id")
    List<Map<String,Object>> ficart();
    @Delete("DELETE from f_cart where id=#{id};")
    int del(Integer id);
}
